<?php
define('o', 0); //声明可以访问 
// 载入初始化且必须在任何输出之前包括HTML标签
require_once('./include/initialize.php');
if (!empty($_GET))
{
	$t = mb_substr($_GET['w'],0,22,'UTF-8');
	if (trim($t) == "")
	{
		header('Location:../');
		die;
	}
	$count = 0 ;
	if (empty($_GET['page']))
	{
		$page = 0;
	}
	else
	{
		$page = (int)$_GET['page'];
		if ($page < 0)
		{
			$page = 0;
		}
	}
	if ($page > 25)
	{
		$page = 25;
	}
	$page = $page * 8;
	$file = ROOT . '/temp/debate/' . md5($t . $page) . '.log';


	$sql = "select distinct goods.goods_id,goods_name,class.class_name,goods.goods_image from  xxx_goods as goods left join xxx_editlog as editlog on editlog.goods_id = goods.goods_id left join xxx_class as class on class.class_id = goods.goods_class where editlog_examine = 0 and editlog.editlog_text like '%$t%' limit $page,8";
	if (!is_file($file))
	{
		$model = new model("xxx_goods");
		$temp = $model->query($sql, array('goods_id', 'goods_name', 'class_name', 'goods_image'), $count);
		$temp['count'] = $count;
		$model->close();
		file_put_contents($file, json_encode($temp));
	}
	else
	{
		if (time() > filemtime($file) + config::create()->page['continue'])
		{
			$model = new model("xxx_goods");
			$temp = $model->query($sql, array('goods_id', 'goods_name', 'class_name', 'goods_image'), $count);
			$temp['count'] = $count;
			$model->close();
			file_put_contents($file, json_encode($temp));
		}
		else
		{
			$temp = json_decode(file_get_contents($file), true);
			$count = $temp['count'];
		}
	}
}
else
{
	header('Location:../');
	die;
}
		if (!empty($_SERVER['HTTP_REFERER'])) {
            setcookie("src",$_SERVER['HTTP_REFERER']);
        }else{
            setcookie("src",$_SERVER['REQUEST_URI']);
        }
?>
<!DOCTYPE HTML>
<html>
 <head>
  <title>爱遥控 - 在线电视机遥控器型号对照查询 </title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="keyword" content="<?php echo $values['goods_name']; ?>爱遥控 遥控器大全 遥控器查询 搜索遥控器 空调遥控器 彩电遥控器 遥控器对照表 国外彩电遥控器 国内彩电遥控器 yaokongqi 万能遥控器" />
 <meta name="description" content=" 爱遥控为广大网友提供更方便的遥控器查询系统，一站式遥控器信息服务,遥控器,机顶盒遥控器,学习型遥控器,单功能遥控器,空调遥控器,电视机遥控器,RF-射频遥控器,下载型遥控器,普通遥控器，永久免费查询。" />
  <link rel="stylesheet" type="text/css" href="/css/in.css" />
     <!--[if gte IE 7]><link rel="stylesheet" type="text/css" href="/css/debate-ie7.css" /><![endif]--> 
  <!--[if gte IE 8]><link rel="stylesheet" type="text/css" href="/css/debate-ie8.css" /><![endif]-->
  <!--[if !IE]><!--><link rel="stylesheet" type="text/css" href="/css/debate.css" /><!--<![endif]--> 


 </head>
<!--内容开始-->
 <body>
        <div id="bodys">
                <div id="topmany">
                        <div id="top">
                                <a href="."><div id="logo"></div></a>
                        </div>
                        <div id="left">
                                                <form id="myform"  action="debate.php" method="get">
                        <div id="edlin"><input id="edlintext" name="w" type="text" maxlength="30" size="30" value="<?php echo $t;

?>" /></div>
                        </form>
                        <div id="select" onclick="search()">Search</div>
                </div>
                </div>
                <div id="among">
                <?php if (!empty($temp) && $count > 0)
{
	foreach($temp as $key => $values)
	{
		if (!is_array($values))
		{
			continue;
		}

		?>
                        <div class="message">
                                <div class="image">
                                        <img alt="<?php echo $values['goods_name']; ?>" src="<?php if ($values['goods_image'] != '0')
		{
			echo "/images/goods/" . $values['goods_image'];
		}
		else
		{
			echo '/images/goods/default.png';
		}

		?>" >
                                </div>
                                <div class="code">
                                        <div class="left"></div>
                                        <div class="right"><?php echo $values['goods_name'];

		?></div>
                                </div>
                                <div class="brand">
                                        <div class="left">
                                                <a href="search.php?w=<?php echo $values['goods_name'];?>"><div><?php echo $values['class_name'];?></div></a>
                                        </div>
                                        <div class="right">
                                                <div><a href="./augment.php?id=<?php echo $values['goods_id']; ?>">查看详情</a></div>
                                        </div>
                                </div>
                        </div>
                        
                        <?php

	}
}
else
{
	echo '<div id="amongs">抱歉,会员交流讨论区没有找到你要的数据，我们会尽快提供给你，请留意！期间如果有其他会员提供数据你也可以查询到。也可以加入Q群向群主咨询<a style="background-color:#FFFFFF;" target="_blank" href="http://wp.qq.com/wpa/qunwpa?idkey=00500cbd590cd5cdb14e597176df8afdc52d54efa33c8f689eb0e28072edb1a4"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="遥控器匹配共享" title="遥控器匹配共享"></a></div>';
}

?>
                </div>
                <?php if (!empty($temp) && $count > 7 && $page < 25)
{

	?>
                <div id="continue"><a href="debate.php?w=<?php echo $_GET["w"];

	?>&page=<?php echo $page + 1;

	?>">没有找到？没关系后面还有....</a><?php if ($page > 0)
	{
		echo '<script type="text/javascript">window.scrollTo(0,130);</script>';
	}

	?> </div>
                <?php }elseif ($count > 0 || $page >= 26)
{

	?>
                    <div id="continue"><a href="javascript:breaks()">你还没有找到啊？抱歉后面真没有....</a> <?php if ($page * 4 >= $count)
	{
		echo '<script type="text/javascript">window.scrollTo(0,130);</script>';
	}

	?> </div>
                                <?php }

?>
                <div id="about">
                本站数据来源于网络我们不能保证内容的正确性,通过使用本站内容随之而来的风险与本站无关。本站对非营利性内容产生的任何法律问题及风险不承担任何责任。如果您愿意帮助我们发展为更多的人提供帮助您也可以向我们的数据库<a href="/add.php">添加内容</a>, 当使用本站时，代表您已接受了本站的<a href="/about.php">使用条款</a>和<a href="/about.php">隐私条款</a>。 <a href="http://www.miibeian.gov.cn/">赣ICP备13006249</a> 版权所有，保留一切权利。
                </div>
		</div>

<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?6668e0a07b0b9f2d8464728cf2d59d33";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>
		  <script src="/js/select.js"></script>
 </body><!--内容结束-->
</html>
<?php

// print_r(ob_get_contents());4 //ob_flush();
if (is_file(ROOT . '/config/lock1') && filemtime(ROOT . '/config/lock1') + 180 < time())
{ 
	// 这里是你要执行的代码
	foreach(glob(ROOT . '/temp/debate/*.log') as $filename)
	{
		if (filemtime($filename) + config::create()->page['continue'] * 2 < time())
		{
			unlink($filename);
		}
	}
	file_put_contents(ROOT . '/config/lock1', time());
}
else
{
	file_put_contents(ROOT . '/config/lock1', time());
}

?>